﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace black_screen_mode_server.Models
{
    [ValueConversion(typeof(int), typeof(string))]
    public class ConvertCategoryIntToString: IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int val = (int)value;
            if(CategoryConstant.CategoryIntMap.ContainsKey(val))
                return CategoryConstant.CategoryIntMap[val];
            return "未知类型";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if(CategoryConstant.categoryStrMap.ContainsKey((string)value))
                return CategoryConstant.categoryStrMap[(string)value];
            return 0;
        }
    }
}
